<template>
    <view>
        <view class="block_1" v-if="options.currentUser != null">
            <view class="text-wrapper_3">
                <text lines="1" class="text_14">商品金额</text>
                <text lines="1" class="text_15">¥{{ options.availablePrice }}</text>
            </view>
            <view class="image_3"></view>
            <view class="text-wrapper_4 flex flex-justify-between" v-if="options.currentUser.allIntegral < 1000">
                <text lines="1" class="text_16">积分</text>
                <text lines="1" class="text_17">共{{ options.currentUser.allIntegral }}积分,积分小于1000不可用</text>
            </view>
            <view class="text-wrapper_4 flex flex-justify-between" v-if="options.currentUser.allIntegral >= 1000 && deductionAmount == null" @tap.stop.prevent="select">
                <view>
                    <text lines="1" class="text_16">积分</text>
                    <text lines="1" class="text_16_my">（共{{ options.currentUser.allIntegral }}积分）</text>
                </view>
                <view>
                    <text lines="1" class="text_16_my_q" style="color: rgba(31, 34, 41, 1)">去选择</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>
            </view>
            <view class="text-wrapper_4 flex flex-justify-between" v-if="options.currentUser.allIntegral >= 1000 && deductionAmount != null" @tap.stop.prevent="select">
                <view>
                    <text lines="1" class="text_16">积分</text>
                    <text v-if="deductionAmount == 0" lines="1" style="color: #fc5f0f; font-size: 26rpx">（共{{ jifen }}积分）</text>
                </view>
                <view>
                    <text v-if="deductionAmount != 0" lines="1" style="color: #fc5f0f; font-size: 26rpx; margin-right: 4rpx">-￥{{ format.toFixed(deductionAmount) }}</text>
                    <text v-else lines="1" class="text_16_my_q" style="color: rgba(31, 34, 41, 1)">去选择</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>
            </view>
            <view class="image_3"></view>
            <view class="group_6" v-if="deductionAmount2 == null">
                <view>
                    <text lines="1" class="text_18">余额</text>
                    <text lines="1" class="text_19">¥{{ format.toFixed(options.currentUser.walletMoney) }}</text>
                    <text lines="1" @tap.stop.prevent="recharge" :decode="true" class="text_20">去充值&gt;&gt;</text>
                </view>
                <view class="image-text_4" @tap.stop.prevent="select2" style="margin-left: 146px" v-if="options.currentUser.walletMoney == 0">
                    <text lines="1" class="text-group_4">无可用</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>

                <view class="image-text_4" style="margin-left: 0; text-align: right" v-else @tap.stop.prevent="select2">
                    <text lines="1" class="text-group_4" style="color: rgba(31, 34, 41, 1); font-size: 26rpx">去选择</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>
            </view>

            <view class="group_6 flex flex-justify-between" v-if="deductionAmount2 != null">
                <view>
                    <text lines="1" class="text_18">余额</text>
                    <text lines="1" class="text_19">¥{{ format.toFixed(options.currentUser.walletMoney - deductionAmount2) }}</text>
                    <text lines="1" @tap.stop.prevent="recharge" :decode="true" class="text_20">去充值&gt;&gt;</text>
                </view>

                <view class="image-text_4" @tap.stop.prevent="select2">
                    <text lines="1" class="text-group_4" style="color: #fc5f0f" v-if="deductionAmount2 != 0">-￥{{ format.toFixed(deductionAmount2) }}</text>
                    <text v-if="options.currentUser.walletMoney != 0 && deductionAmount2 == 0" lines="1" class="text_16_my_q" style="color: rgba(31, 34, 41, 1)">去选择</text>

                    <text lines="1" class="text-group_4" v-if="options.currentUser.walletMoney == 0">无可用</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>
            </view>
        </view>

        <view class="block_1" v-else>
            <view class="text-wrapper_3">
                <text lines="1" class="text_14">商品金额</text>
                <text lines="1" class="text_15">¥{{ options.availablePrice }}</text>
            </view>
            <view class="image_3"></view>

            <view class="text-wrapper_4 flex flex-justify-between" @tap.stop.prevent="logOn">
                <view><text lines="1" class="text_16">积分</text></view>
                <view>
                    <text lines="1" class="text_16_my_q" style="color: rgba(170, 170, 170, 1)">授权登录</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>
            </view>
            <view class="image_3"></view>
            <view class="group_6">
                <view>
                    <text lines="1" class="text_18">余额</text>
                    <text lines="1" class="text_19">¥{{ format.toFixed(options.currentUser.walletMoney) }}</text>
                    <text lines="1" @tap.stop.prevent="recharge" :decode="true" class="text_20">去充值&gt;&gt;</text>
                </view>
                <view class="image-text_4" @tap.stop.prevent="select2" style="margin-left: 146px" v-if="options.currentUser.walletMoney == 0">
                    <text lines="1" class="text-group_4">无可用</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>

                <view class="image-text_4" style="margin-left: 0; text-align: right" v-else @tap.stop.prevent="logOn">
                    <text lines="1" class="text-group_4" style="color: rgba(170, 170, 170, 1); font-size: 26rpx">授权登录</text>
                    <image src="https://static.lixingpt.com/d096c3b4-d127-4ab5-b097-16acb3ff6e31.png" style="width: 12rpx; height: 20rpx"></image>
                </view>
            </view>
        </view>
    </view>
</template>
<script module="format" lang="wxs" src="@/utils/farmat.wxs"></script>
<script>
// components/PointAmount/index.js
export default {
    data() {
        return {};
    },
    /**
     * 组件的属性列表
     */
    props: {
        options: Object,
        deductionAmount: null,
        deductionAmount2: null,
        jifen: null
    },
    /**
     * 组件的方法列表
     */
    methods: {
        select() {
            this.$emit('select');
        },
        select2() {
            this.$emit('select2');
        },
        //去充值
        recharge() {
            uni.navigateTo({
                url: '/pages/recharge/index'
            });
        },
        //去登录
        logOn() {
            uni.navigateTo({
                url: '/pages/login/index'
            });
        }
    },
    created: function () {}
};
</script>
<style>
@import './index.css';
</style>
